<?php
$url=$_SERVER['REQUEST_URI'];
$url = ltrim($url,'/');
$is_mpe = false;
if(strpos('admin/paymentUser/add',$url) !== false){
	$is_mpe = true;
}else{
	$url = str_replace('add','index',$url);
	$url = str_replace('edit','index',$url);
}

$num = '';
$num1 = '';
$sys_arr = array();
$mpe_arr = array();
$offer_arr = array();
$quote_arr=array();
foreach($__sysmenus as $key=>$val){
	if($val[url] == 'system'){
		$sys_arr[$key] = $val[id];
	}
	if($val[url] == 'mpe'){
		$mpe_arr[$key] = $val[id];
	}
	if($val[url] == 'offer'){
		$offer_arr[$key] = $val[id];
	}
    if($val[url] == 'quote'){
        $quote_arr[$key] = $val[id];
    }
	foreach($val[subs] as $k=>$v){

		if(strpos($url,$v[url]) !== false){

			$menu_pid = $v[pid];
			$menu_id = $v[id];
			$menu_purl = $v[url];
			$menu_key = $key;
		}
	}
}
//var_dump($sys_arr);die;
?>
<section class="left-section">
	{if in_array($menu_pid,$sys_arr)}
	<dl id="leftNav" data-pid="kzmb">
		<dt><i class="glyphicon glyphicon-eye-open"></i> 控制面板</dt>
		{loop $sys_arr $k $v}
		<dd><a class="{if $menu_pid==$v}mb active{else}mbh{/if}" href="/{$__sysmenus[$k][subs][0][url]}">{$__sysmenus[$k][name]}</a></dd>
		{/loop}
	</dl>
	{/if}
	{if in_array($menu_pid,$mpe_arr) || $is_mpe==true}
	<dl id="leftNav" data-pid="mpe">
		<dt><i class="glyphicon glyphicon-eye-open"></i> MPE管理</dt>
		<?php $num=1;?>
		{loop $mpe_arr $k $v}
		{if $is_mpe==true && $num==1}
		<dd><a class="mb active" href="/{$__sysmenus[$k][subs][0][url]}">{$__sysmenus[$k][name]}</a></dd>
		{else}
		<dd><a class="{if $menu_pid==$v}mb active{else}mbh{/if}" href="/{$__sysmenus[$k][subs][0][url]}">{$__sysmenus[$k][name]}</a></dd>
		{/if}
		<?php $num++;?>
		{/loop}
	</dl>
	{/if}
	{if in_array($menu_pid,$offer_arr)}
	<dl id="leftNav" data-pid="offer">
		<dt><i class="glyphicon glyphicon-eye-open"></i> 报价工具</dt>
		{loop $offer_arr $k $v}
		<dd><a class="{if $menu_pid==$v}mb active{else}mbh{/if}" href="/{$__sysmenus[$k][subs][0][url]}">{$__sysmenus[$k][name]}</a></dd>
		{/loop}
	</dl>
	{/if}
	{if in_array($menu_pid,$quote_arr)}
	<dl id="leftNav" data-pid="quote">
		<dt><i class="glyphicon glyphicon-eye-open"></i> 行情工具</dt>
		{loop $quote_arr $k $v}
		<dd><a class="{if $menu_pid==$v}mb active{else}mbh{/if}" href="/{$__sysmenus[$k][subs][0][url]}">{$__sysmenus[$k][name]}</a></dd>
		{/loop}
	</dl>
	{/if}
</section>
